package com.example.ceramics.data;

import com.example.ceramics.R;
import com.example.ceramics.entity.GoodsEntity;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Cart {
    private static List<GoodsEntity> goodsList = new ArrayList<>();

    public static List<GoodsEntity> getGoodsEntities() {
        return goodsList;
    }

    public static void setGoodsEntities(List<GoodsEntity> goodsEntities) {
        goodsList = goodsEntities;
    }

    public static void addGoodsEntity(GoodsEntity goodsEntity) {
        goodsList.add(goodsEntity);
    }

    public static void addGoodsEntities(List<GoodsEntity> goodsEntities) {
        goodsList.addAll(goodsEntities);
    }

    public static boolean isNull() {
        if (goodsList == null || goodsList.size() == 0) {
            return true;
        }
        return false;
    }

    public static void test() {
        for (int i = 0; i < 4; i++) {
            GoodsEntity goodsEntity = new GoodsEntity();
            goodsEntity.setGoodsName("陶瓷");
            goodsEntity.setGoodsPrice(50.0);
            goodsEntity.setGoodsSignature("陶瓷陶瓷");
            goodsEntity.setGoodsType("定制服务");
            goodsEntity.setGoodsImg(R.mipmap.image2);
            goodsList.add(goodsEntity);
        }
    }
}